package org.example.nonmaterial;

import org.example.models.interfaces.own.Ownable;
import org.example.person.Person;

import java.util.Objects;


//Class to set relationship between some people
public class Relationship implements Ownable {

    public enum Type {
        FRIENDSHIP;
    }

    public final Person personA;
    public final Person personB;
    private Type type;


    public Relationship(Person personA, Person personB, Type type) {
        this.personA = personA;
        this.personB = personB;
        this.type = type;

    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Relationship that)) return false;
        return Objects.equals(personA, that.personA) && Objects.equals(personB, that.personB) && type == that.type;
    }

    @Override
    public int hashCode() {
        return Objects.hash(personA, personB, type);
    }

    @Override
    public String
    toString() {
        return String.format("Relationship[personA=%s, personB=%s, type=%s", personA, personB, type); 
    }
}
